import { PLATE_COLOR_MAP, TRIP_STATE_MAP } from '@/constants/enums';
import useMaterial from '@/hooks/useMaterial';
import { formatSeconds } from '@/utils/format';
import { Descriptions } from 'antd';

const Trip = (props) => {
  const { data } = props;
  const { materialTypeMap } = useMaterial();
  const items = [
    {
      label: '组织',
      children: data?.groupName ?? '',
    },
    {
      label: '线路',
      children: data?.lineName ?? '',
    },
    {
      label: '车牌号',
      children: data?.license ?? '',
    },
    {
      label: '车牌颜色',
      children: PLATE_COLOR_MAP[data?.plateColor] ?? '',
    },
    {
      label: '司机',
      children: data?.realname ?? '',
    },
    {
      label: '电话',
      children: data?.phone ?? '',
    },
    {
      label: '计划日期',
      children: data?.planDate ?? '',
    },
    {
      label: '物料类型',
      children: materialTypeMap[data?.type] ?? '',
    },
    {
      label: '状态',
      children: TRIP_STATE_MAP[data?.state] ?? '',
    },
    {
      label: '趟次时间',
      children: data?.tripTime ?? '',
    },
    {
      label: '开始时间',
      children: data?.beginTime ?? '',
    },
    {
      label: '进装货地时间',
      children: data?.inLoadTime ?? '',
    },
    {
      label: '出装货地时间',
      children: data?.outLoadTime ?? '',
    },
    {
      label: '装货时长',
      children: formatSeconds(data?.loadDurations) ?? '',
    },
    {
      label: '装货司机',
      children: data?.loadDriver ?? '',
    },
    {
      label: '装货司机电话',
      children: data?.loadPhone ?? '',
    },
    {
      label: '进卸货地时间',
      children: data?.inUnloadTime ?? '',
    },
    {
      label: '出卸货地时间',
      children: data?.outUnloadTime ?? '',
    },
    {
      label: '卸货时长',
      children: formatSeconds(data?.unloadDurations) ?? '',
    },
    {
      label: '卸货司机',
      children: data?.unloadDriver ?? '',
    },
    {
      label: '卸货司机电话',
      children: data?.unloadPhone ?? '',
    },
    {
      label: '结束时间',
      children: data?.endTime ?? '',
    },
    {
      label: '总时长',
      children: formatSeconds(data?.duration) ?? '',
    },
    {
      label: '总里程（km）',
      children: data?.mileages ?? '',
    },
  ];
  return <Descriptions bordered items={items} />;
};

export default Trip;
